package com.axapoint.opoc.core;

import java.util.List;

import org.joda.time.Interval;

import com.axapoint.opoc.core.dao.ObjectRegistration;

public class IntervalException extends UserException {
	private static final long serialVersionUID = 1L;

	private final List<ObjectRegistration> entities;
	private final Interval interval;
	
	public IntervalException(String message, Interval interval, List<ObjectRegistration> entities) {
		super(message);
		
		this.entities = entities;
		this.interval = interval;
	}
	public Interval getInterval() {
		return interval;
	}
	public ObjectRegistration[] getEntities() {
		return entities.toArray(new ObjectRegistration[0]);
	}
	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer(super.toString());
		
		for (Object o : entities) {
			sb.append(o.toString()).append('\n');
		}
		return sb.toString();
	}
}
